<?php
    @session_start();
    include("template/head.php");
	$sqlEn = "SELECT * FROM `st_attr_entree` WHERE id_entree='".$_GET['id_entree']."'";
	$obj = new Mysql ();
	$resultEn = mysql_query($sqlEn);
	$rowEn = mysql_fetch_array($resultEn);
?>
    <div class="container-fluid">
        <div class="row-fluid">
                
        <?php include("template/menu_left.php") ?>                
        <div class="span10" id="content">
            <div class="row-fluid">
			<form id="formAddIntervention" class="form-horizontal"  enctype="multipart/form-data" method="POST" action="submit/entree/edit_entree.php">
            
            <!-- block -->
                <!--  ************************ ROW ************************ -->
              <div class="span12">   
                 <div class="block">
                    <div class="navbar navbar-inner block-header">
                        <div class="muted pull-left">Editer Article</div>
                        <input type="hidden" value="<?php echo $rowEn['id_entree'] ?>" name="id_entree" />
                        <!-- .toolbar -->
                    </div>   
                    <div class="block-content in" id="div-1">
                    
                    <div class="control-group">  
                    	
                        <label class="control-label span4" for="ref_article">Réference Article</label>
                          <div class="controls">
							<select class="validate[required] form-control" id="ref_article" name="ref_article" disabled>
        					<option value="<?php echo $rowEn['id_article'] ?>" style=" margin:5px; background-repeat:no-repeat; background-size: 32px 32px;
											background-image:url(article_pic/<?php echo getPhotoName($rowEn["id_article"]) ?>); padding-left:4em;"><?php echo getRefArticle($rowEn['id_article']); ?></option>
							<?php
								$table = "SELECT DISTINCT (`ref_article`), `id_article`, `photo_name` FROM st_article ORDER BY id_article ASC;";     
								$colonne = mysql_query($table);     
								while($data = mysql_fetch_array($colonne)){
									echo '<option value="'.$data["id_article"].'" style=" margin:5px; background-repeat:no-repeat; background-size: 32px 32px;
								background-image:url(article_pic/'.$data["photo_name"].'); padding-left:4em;">'.$data["ref_article"].'</option>';
								}
								?>
						 	</select>	
                          </div>
                    </div>
                    
                    <div class="control-group">  
                        <label class="control-label span4" for="ref_article">Désignation</label>
                          <div class="controls">
							<input type="text" name="designation" value="<?php echo getDesignation($rowEn["id_article"]) ?>" class="validate[required,custom[integer]] form-control" placeholder="Désignation" id="designation" disabled>	
                          </div>
                    </div>
                    
                    <div class="control-group">
                        <label for="comment" class="control-label span4"  for="pass1">Fournisseur</label>
                    	<div class="controls">
                        <select id="id_fournisseur" class="validate[required] form-control chzn-select" name="id_fournisseur">
                                   <option value="<?php echo $rowEn["id_fournisseur"] ?>"><?php echo getFournisseur($rowEn["id_fournisseur"])['raison_social'] ?></option>
                                                <?php
                                                        $table = "SELECT DISTINCT (`nom_fournisseur`), `id_fournisseur`, `raison_social` FROM st_att_fournisseur ORDER BY nom_fournisseur ASC;";     
                                                        $colonne = mysql_query($table);     
                                                        while($data = mysql_fetch_array($colonne)){
                                                                echo '<option value="'.$data["id_fournisseur"].'">'.$data["raison_social"].'</option>';
                                                        }
                                                ?>
                                </select>
                      	</div>
                    </div>
                    
                    <div class="control-group">
                        <label for="comment" class="control-label span4"  for="pass1">Quantité</label>
                    	<div class="controls">
           					<input style="margin-right:2em; width:220px" type="text" value="<?php echo $rowEn["qte"] ?>" name="qte" class="validate[required,custom[integer]] form-control col-lg-5" placeholder="Quantité" id="form-validation-field-3">
							<select id="unit" class="validate[required] form-control" name="unit" style="width:150px" disabled>
		                      <option value=""><?php echo getUnitArticle($rowEn["id_article"]) ?></option>
		                        <?php
									$table = "SELECT DISTINCT (`valeur`), `id_unite_stockage` FROM st_att_unite_stockage ORDER BY nb_pieces ASC;";     
									$colonne = mysql_query($table);     
									while($data = mysql_fetch_array($colonne)){
										echo '<option value="'.$data["id_unite_stockage"].'">'.$data["valeur"].'</option>';
									}
								?>
							</select> 
                      	</div>
                    </div>
                    
                    <div class="control-group">
                        <label for="comment" class="control-label span4"  for="pass1">Prix d'achat</label>
                    	<div class="controls">
           		             <input style="margin-right:2em; width:220px" type="text" value="<?php echo $rowEn["prix"] ?>" name="prix" class="validate[required,custom[number]] form-control" placeholder="Prix de vente" id="form-validation-field-3">
                      	</div>
                    </div>
                    <div class="control-group">
                        <label for="comment" class="control-label span4"  for="pass1">Prix de devise</label>
                            <input type="text" value="<?php echo $rowEn["prix_en_devise"] ?>" name="prix_en_devise" class="form-control" placeholder="Prix en devise" id="form-validation-field-1">
                         	
                         	<select id="unit" class="form-control span2 validate" name="id_monnaie" style="margin: 0 0 0 14px;">
                                    <option value="">Devise</option>
                                    <?php
                                        $table = "SELECT DISTINCT `nom_monnaie`, `id_monnaie` FROM st_att_monnaie";     
                                        $colonne = mysql_query($table);     
                                        
                                        while($data = mysql_fetch_array($colonne)){
                                         ?>
                                        <option value="<?php echo $data["id_monnaie"];?>" <?php if($data["id_monnaie"] == $rowEn["id_devise"]) echo "selected";?>><?php echo $data["nom_monnaie"]?></option>
                                        <?php
                                        }
                                   ?>
                                </select>
            		
                          </div>    
                    
                     <div class="control-group">
                            <label for="comment" class="control-label span4">Date Ajout</label>
                            <div class="controls">
                              <input value="<?php echo $rowEn['date_add']?>" type="text" data-color-format="rgb" data-color="rgb(255, 146, 180)" data-date-format="dd/mm/yyyy" name="dateAdd" id="date01" class="datepicker validate[required] form-control">
                            </div>
                        </div>  

                    <div class="control-group">
                    	<label for="comment" class="control-label span4">Note</label>
                        <div class="controls">
                        	<textarea id="comment" name="comment" placeholder="Mettez votre note ici..." class="form-control" style="width:402px;"><?php echo $rowEn['note'] ?></textarea>
                        </div>
                    </div>  
                             <!-- /.control-group -->
                    </div>
                    </div>
              </div>
            <!--  ************************ / ROW ************************  -->
            
              <div class="span12" style="margin-left:0px;">
              <div class="form-group">
                <div class="col-lg-8">
                    <input type="submit" value="Valider" class="validate[required] btn btn-primary" style="margin-bottom:1em; float: right;" name="marque_ajout" id="submitEntry">
               </div>
          </div>         
             </form>   
            </div>
          
          </div>
            <hr>
        </div>
<?php  include("template/footer_vente_achat.php") ; ?>